<div class="span2 sidebar" style="width:176px;">
    <div class="accordion" id="accordion2">
        <?php if ($this->session->userdata('level') >= 3) { ?>
            <?php if( $this->session->userdata('page') == 1 || $this->session->userdata('page') == 7 || $this->session->userdata('page') == 11 || $this->session->userdata('page') == 13 ){ ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse1"><i class="icon-home"></i> <?php echo lang('sidebar_estate_head')?></a>
                </div>
                <div id="collapse1" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/estateAll"><i class="icon-home"></i> <?php echo lang('sidebar_estate_all')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateShowcase"><i class="icon-bookmark"></i> <?php echo lang('sidebar_estate_showcase')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateConfirm"><i class="icon-trash"></i> <?php echo lang('sidebar_estate_draft')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateAdd"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_estate_newadd')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateCat"><i class="icon-folder-open-alt"></i> <?php echo lang('sidebar_estate_cats')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateType"><i class="icon-folder-open-alt"></i> <?php echo lang('sidebar_estate_type')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateProperty"><i class="icon-cog"></i> <?php echo lang('sidebar_estate_property')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateSelectbox"><i class="icon-cog"></i> <?php echo lang('sidebar_estate_selectbox')?></a></li>
                        <?php
                            if ($this->session->userdata('user_id') == 1){
                        ?><li><a href="<?php echo site_url(); ?>admin/estateAttribute"><i class="icon-cog"></i> <?php echo lang('sidebar_estate_attributes')?></a></li>
                        <?php } ?>
                    </ul>
                </div>
            </div>
        <?php } } ?>
        <?php if ($this->session->userdata('level') >= 1) { ?>
            <?php if($this->session->userdata('page') == 2 || $this->session->userdata('page') == 6 || $this->session->userdata('page') == 10){ ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse2"><i class="icon-pencil"></i> <?php echo lang('sidebar_blog_head')?></a>
                </div>
                <div id="collapse2" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/blogAll"><i class="icon-pencil"></i> <?php echo lang('sidebar_blog_all')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/blogAdd"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_blog_add')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/blogConfirm"><i class="icon-trash"></i> <?php echo lang('sidebar_blog_confirm')?></a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
        <?php } ?>
        <?php if ($this->session->userdata('level') >= 4) { ?>
         <?php if($this->session->userdata('page') == 2){ ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse3"><i class="icon-file"></i> <?php echo lang('sidebar_pages_head')?> </a>
                </div>
                <div id="collapse3" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/pageAll"><i class="icon-copy"></i> <?php echo lang('sidebar_pages_all')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/pageAdd"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_pages_add')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/pageConfirm"><i class="icon-trash"></i> <?php echo lang('sidebar_blog_confirm')?></a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
        <?php } ?>
        
        <?php if ($this->session->userdata('level') >= 4) { ?>
            <?php if ($this->session->userdata('page') == 5) { ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse6"><i class="icon-user"></i> <?php echo lang('sidebar_user_head')?></a>
                </div>
                <div id="collapse6" class="accordion-body collapse <?php echo (strstr(uri_string(), '/user')) ? "in" : "" ?>">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/userAll"><i class="icon-group"></i> <?php echo lang('sidebar_user_all')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/userAdd"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_user_add')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/userAllGroup"><i class="icon-group"></i> <?php echo lang('sidebar_user_groupall')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/userGroup"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_user_groupadd')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/userProfile"><i class="icon-user"></i> <?php echo lang('sidebar_user_profile')?></a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
        <?php } ?>
        <?php if ($this->session->userdata('level') >= 5) { ?>
             <?php if($this->session->userdata('page') == 2 || $this->session->userdata('page') == 6 || $this->session->userdata('page') == 10){ ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse7"><i class="icon-wrench"></i> <?php echo lang('sidebar_set_head')?></a>
                </div>
                <div id="collapse7" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/setGeneral"><i class="icon-wrench"></i> <?php echo lang('sidebar_set_general')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/setContact"><i class="icon-info-sign"></i> <?php echo lang('sidebar_set_contact')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/setEmail"><i class="icon-envelope"></i> <?php echo lang('sidebar_set_mail')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/setImage"><i class="icon-picture"></i> <?php echo lang('sidebar_set_image')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/setView"><i class="icon-eye-open"></i> <?php echo lang('sidebar_set_view')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/setCore"><i class="icon-cogs"></i> <?php echo lang('sidebar_set_core')?></a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
        <?php } ?>
        
         <?php if ($this->session->userdata('level') >= 3) { ?>
            <?php if( $this->session->userdata('page') == 1 || $this->session->userdata('page') == 7 || $this->session->userdata('page') == 11 || $this->session->userdata('page') == 13){ ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse8"><i class="icon-home"></i> Purchases <?php //echo lang('sidebar_estate_head') ?></a>
                </div>
                <div id="collapse8" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>inventories"><i class="icon-home"></i> All Purchases<?php //echo lang('sidebar_estate_all') ?></a></li>
                        <li><a href="<?php echo site_url(); ?>inventories/add"><i class="icon-bookmark"></i> Add Purchase<?php //echo lang('sidebar_estate_showcase') ?></a></li>
                        <li><a href="<?php echo site_url(); ?>inventories/csv_inventory"><i class="icon-trash"></i> Add Purchase by CSV<?php //echo lang('sidebar_estate_draft') ?></a></li>
                        
                    </ul>
                </div>
            </div>
        <?php } }?>
        
        <?php if ($this->session->userdata('level') >= 4) { ?>
             <?php if ($this->session->userdata('page') == 9 || $this->session->userdata('page') == 26 || $this->session->userdata('page') == 8 || $this->session->userdata('page') == 17) { ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse9"><i class="icon-money"></i> <?php echo lang('sidebar_sales_head')?></a>
                </div>
                <div id="collapse9" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/salesAllInvoices"><i class="icon-money"></i> <?php echo lang('sidebar_sales_all_invoices')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/salesAddInvoice"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_sales_add_invoice')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/salesListQuotations"><i class="icon-money"></i> <?php echo lang('sidebar_sales_list_quotations')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/salesAddQuotation"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_sales_add_quotation')?></a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
             <?php if ($this->session->userdata('page') == 9 || $this->session->userdata('page') == 26 || $this->session->userdata('page') == 8 || $this->session->userdata('page') == 17) { ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse10"><i class="icon-group"></i> <?php echo lang('sidebar_customers_head')?></a>
                </div>
                <div id="collapse10" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/customerAll"><i class="icon-group"></i> <?php echo lang('sidebar_customer_list')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/customerAdd"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_customer_add')?></a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
            <?php if($this->session->userdata('page') == 2 || $this->session->userdata('page') == 6 || $this->session->userdata('page') == 10){ ?>           
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse11"><i class="icon-list-alt"></i> <?php echo lang('sidebar_invoice_settings')?></a>
                </div>
                <div id="collapse11" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/invoiceGeneralSetting"><i class="icon-list-alt"></i> <?php echo lang('sidebar_general_setting')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/invoiceCompanyDetails"><i class="icon-list-alt"></i> <?php echo lang('sidebar_company_details')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/invoiceChangeLogo"><i class="icon-list-alt"></i> <?php echo lang('sidebar_change_logo')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/invoiceTaxRates"><i class="icon-list-alt"></i> <?php echo lang('sidebar_tax_rates')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/invoiceAddTaxRate"><i class="icon-list-alt"></i> <?php echo lang('sidebar_add_tax_rate')?></a></li>
                    </ul>
                </div>
            </div><?php } ?>
            <?php if( $this->session->userdata('page') == 1 || $this->session->userdata('page') == 7 || $this->session->userdata('page') == 11 || $this->session->userdata('page') == 13){ ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion31" href="#collapse31"><i class="icon-copy"></i> Tickets</a>
                </div>
                <div id="collapse31" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>tickets"><i class="icon-copy"></i> Tickets</a></li>
                        <li><a href="<?php echo site_url(); ?>tickets/create"><i class="icon-plus-sign-alt"></i> Create New Ticket</a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
            <?php if ($this->session->userdata('page') == 25 || $this->session->userdata('page') == 12) { ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion32" href="#collapse32"><i class="icon-tag"></i> Departments</a>
                </div>
                <div id="collapse32" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>departments"><i class="icon-tag"></i> Departments</a></li>
                        <li><a href="<?php echo site_url(); ?>departments/create"><i class="icon-plus-sign-alt"></i> Create New Department</a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
            <?php if( $this->session->userdata('page') == 1 || $this->session->userdata('page') == 7 || $this->session->userdata('page') == 11 || $this->session->userdata('page') == 13 ){ ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse12"><i class="icon-list-alt"></i> <?php echo lang('sidebar_suppliers')?></a>
                </div>
                <div id="collapse12" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/listSuppliers"><i class="icon-list-alt"></i> <?php echo lang('sidebar_suppliers_list')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/newSupplier"><i class="icon-list-alt"></i> <?php echo lang('sidebar_supplier_new')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/addSuppliersCsv"><i class="icon-list-alt"></i> <?php echo lang('sidebar_suppliers_add_csv')?></a></li>
                    </ul>
                </div>
            </div>
        <?php } } ?>
         <!-- /Files -->
        <?php if($this->session->userdata('page') == 0){ ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse4"><i class="icon-picture"></i> <?php echo lang('sidebar_gallery_head')?></a>
                </div>
                <div id="collapse4" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/mediaAll"><i class="icon-picture"></i> <?php echo lang('sidebar_gallery_all')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/mediaCustom"><i class="icon-picture"></i> <?php echo lang('sidebar_gallery_custom')?></a></li>
                    </ul>
                </div>
            </div>

        
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse14"><i class='icon-question-sign sps'></i>FAQS </a>
                </div>
                <div id="collapse14" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>faqs/index"><i class='icon-question-sign sps'></i>Questions List</i></li>
                    </ul>
                </div>
            </div>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse20"><i class="icon-file"></i> File Archive</a>
                </div>
                <div id="collapse20" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url('admin/files'); ?>"><i class="icon-file-alt"></i> File Archive</a></li>
                    </ul>
                </div>
            </div>
             <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion13" href="#collapse13"><i class="icon-info-sign"></i>News </a>
                </div>
                <div id="collapse13" class="accordion-body collapse in">
                        <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>news/index"><i class="icon-info-sign sps"></i>Broadcast News</a></li>
                        <li><a href="<?php echo site_url(); ?>news/subscribers/"><i class="icon-info-sign sps"></i>Subscribers</a></li>
                    </ul>
                </div>
            </div>
<?php } ?>
           
        
         
        
         <!-- Messages -->
        <?php if ($this->session->userdata('level') >= 1): ?>
            <?php if ($this->session->userdata('page') == 16): ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse15">
                        <i class="icon-comment"></i> <span><?php echo lang('sidebar_messages_head') ?> 
                            <?php
                            $this->db->where('status', 'Unread');
                            $this->db->where('deleted', 0);
                            $query = $this->db->where('user_to', $this->session->userdata('user_id'))->get('messages');
                            $unread = $query->num_rows();
                            ?>

                            <?php if ($unread): ?>
                                <span class="badge badge-important"><?= $unread ? $unread : '' ?></span>
                            <?php endif; ?>
                        </span>
                    </a>
                </div>
                <div id="collapse15" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/messages/inbox"><i class="icon-inbox"></i> <?php echo lang('sidebar_messages_inbox'); ?> <span class="badge badge-info"><?= $unread ? $unread : '' ?></span></a></li>
                        <li>
                            <a href="<?php echo site_url(); ?>admin/messages/sent">
                                <i class="icon-inbox"></i> <?php echo lang('sidebar_messages_sent'); ?> 
                                <span class="badge badge-success">
                                    <?php
                                    $query = $this->db->where('user_from', $this->session->userdata('user_id'))->get('messages');
                                    echo $query->num_rows();
                                    ?>
                                </span>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        <?php endif; ?>
        <?php endif; ?>

        <!-- Members -->
        <?php if ($this->session->userdata('level') >= 4) { ?>
         <?php if ($this->session->userdata('page') == 9 || $this->session->userdata('page') == 26 || $this->session->userdata('page') == 8 || $this->session->userdata('page') == 17) { ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse16"><i class="icon-user"></i> <?php echo lang('sidebar_members_head'); ?></a>
                </div>
                <div id="collapse16" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/members"><i class="icon-user"></i> <?php echo lang('sidebar_members_members'); ?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/memberships"><i class="icon-certificate"></i> <?php echo lang('sidebar_members_memberships'); ?></a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
        <?php } ?>
        <!-- /Members -->
        
        <!-- Payments -->
        <?php if ($this->session->userdata('level') >= 1) { ?>
             <?php if ($this->session->userdata('page') == 18) { ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse17"><i class="icon-money"></i> <?php echo lang('payments'); ?></a>
                </div>
                <div id="collapse17" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin_payments"><i class="icon-money"></i> <?php echo lang('payments'); ?></a></li>
                    </ul>
                </div>
            </div>
           <?php } ?>
           <?php if ($this->session->userdata('page') == 19) { ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse18"><i class="icon-money"></i> <?php echo lang('reports'); ?></a>
                </div>
                <div id="collapse18" class="accordion-body collapse <?php echo (strstr(uri_string(), '/reports')) ? "in" : "" ?>">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>reports/daily_sales"><i class="icon-money"></i> <?php echo lang('daily_sales'); ?></a></li>
                        <li><a href="<?php echo site_url(); ?>reports/monthly_sales"><i class="icon-money"></i> <?php echo lang('monthly_sales'); ?></a></li>
                        <li><a href="<?php echo site_url(); ?>reports/purchases"><i class="icon-money"></i> Purchase Sales</a></li>
                        <li><a href="<?php echo site_url(); ?>reports/payments"><i class="icon-money"></i> <?php echo lang('payments'); ?></a></li>
                        <li><a href="<?php echo site_url(); ?>reports/logins"><i class="icon-money"></i> Login Stats</a></li>
                    </ul>
                </div>
            </div>
          <?php } ?>
        <?php } ?>
        <!-- /Payments -->
        
        <!-- Member Agent -->
        <?php if ($this->session->userdata('level') >= 4) { ?>
            <?php if ($this->session->userdata('page') == 20) { ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse19"><i class="icon-group"></i> Manage Agents</a>
                </div>
                <div id="collapse19" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url('admin/agents'); ?>"><i class="icon-group"></i> Manage Agents</a></li>
                        <li><a href="<?php echo site_url('admin/agents/create'); ?>"><i class="icon-plus-sign-alt"></i> Create Agent</a></li>
                    </ul>
                </div>
            </div>
        <?php } }?>
        <!-- /Payments -->
        <!-- Control Panel -->
<!-- imtiaz -->

<?php if ($this->session->userdata('level') >= 4) { ?>
 <?php if($this->session->userdata('page') == 22){ ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" 
                       data-parent="#accordion2" href="<?php echo site_url('email_marketing'); ?>"><i class="icon-inbox"></i> Email Dashboard</a>
                </div>
                
            </div>
              <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse34"><i class='icon-inbox'></i>Email Templates</a>
                </div>
                <div id="collapse34" class="accordion-body collapse 
				<?php 
				if($this->uri->segment(2)=='template' || $this->uri->segment(2)=='add_emailmarketing_template' )
				{
					echo 'out';
				}else
				{
					echo "in";	
				}
				?>
                 
                 ">
                    <ul class="nav nav-list">
                       <li><a href="<?php echo site_url('email_marketing/template'); ?>"><i class="icon-inbox"></i> Email Templates</a></li>
                       <li><a href="<?php echo site_url('email_marketing/add_emailmarketing_template'); ?>"><i class="icon-inbox"></i> Create Template</a></li>
                    </ul>
                </div>
            </div>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse35"><i class='icon-inbox'></i>Subscriptions</a>
                </div>
                <div id="collapse35" class="accordion-body collapse 
                <?php  if($this->uri->segment(2)=='lists' || $this->uri->segment(2)=='subscription') 
				{
				echo 'out';
				} 								
				else {
				 echo "in"; }
				 ?>">
                    <ul class="nav nav-list">
                       <li><a href="<?php echo site_url('email_marketing/lists'); ?>"><i class="icon-inbox"></i> Mailing List</a></li>
                       <li><a href="<?php echo site_url('email_marketing/subscription'); ?>"><i class="icon-inbox"></i> Subscriptions</a></li>
                       <li><a href="<?php echo site_url('email_marketing/lists/create'); ?>"><i class="icon-inbox"></i> Create Mailing List</a></li>
                    </ul>
                </div>
            </div>
                      
              <div class="accordion-group">
                <div class="accordion-heading">
 <a class="accordion-toggle" data-toggle="collapse"
         data-parent="#accordion2" href="#collapse36"><i class='icon-inbox'></i>Mass Campaign </a>
                </div>          
                <div id="collapse36" class="accordion-body collapse 	
                <?php  if($this->uri->segment(2)=='mass_campaigns' || $this->uri->segment(2)=='mass_campaigns' )
				{
					echo 'out';
				}else
				{
					echo "in";	
				} ?>">
                    <ul class="nav nav-list">
                    
                       <li><a href="<?php echo site_url('email_marketing/mass_campaigns'); ?>"><i class="icon-inbox"></i>mass create</a></li>
                       <li><a href="<?php echo site_url('email_marketing/campaigns'); ?>"><i class="icon-inbox"></i>Campaigns</a></li>
                       <li><a href="<?php echo site_url('email_marketing/campaigns/create'); ?>"><i class="icon-inbox"></i>create campaign</a></li>
                    </ul>
                </div>     
            </div>
             <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse37"><i class='icon-inbox'></i>Hot Leads</a>
                </div>
                <div id="collapse37" class="accordion-body collapse 
                <?php  if($this->uri->segment(2)=='hot_leads' || $this->uri->segment(2)=='hot_leads' )
				{
					echo 'out';
				}else
				{
					echo "in";	
				} ?>">
                    <ul class="nav nav-list">
                    
                       <li><a href="<?php echo site_url('email_marketing/hot_leads'); ?>"><i class="icon-inbox"></i> Hot Leads</a></li>
                       <li><a href="<?php echo site_url('email_marketing/hot_leads'); ?>"><i class="icon-inbox"></i> Create Leads</a></li>
                    </ul>
                </div>  
                
            </div>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" 
                       data-parent="#accordion2" href="<?php echo site_url('email_marketing/sent_mail');?>"><i class='icon-inbox'></i>Sent Mail</a>
                </div>                
            </div>
                        <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" 
                       data-parent="#accordion2" href="<?php echo site_url('email_marketing/alerts');?>"><i class='icon-inbox'></i>Alerts</a>
                </div>                
            </div>
						<div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" 
                       data-parent="#accordion2" href="<?php echo site_url('email_marketing/filters');?>"><i class='icon-inbox'></i>Filters</a>
                </div>     
                </div>
            <?php } } ?>
            
            <!-- Imtiaz -->




        <!-- Files -->
        <?php if ($this->session->userdata('level') >= 4) { ?>
           
            <?php if($this->session->userdata('page') == 23){ ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion2" href="#collapse30"><i class="icon-download"></i> Export Data</a>
                </div>
                <div id="collapse30" class="accordion-body collapse <?php echo (strstr(uri_string(), '/export')) ? "in" : "" ?>">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url('admin/export'); ?>"><i class="icon-download-alt"></i> Export Data</a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
             <?php if ($this->session->userdata('page') == 24) { ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion31" href="#collapse31"><i class="icon-home"></i> Property Management</a>
                </div>
                <div id="collapse31" class="accordion-body collapse in">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/estateLandlord"><i class="icon-folder-open-alt"></i> <?php echo lang('sidebar_estate_lanlords')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateLandlordAdd"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_pmp_landlord')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateApartment"><i class="icon-folder-open-alt"></i> <?php echo lang('sidebar_pmp_apartment')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateApartmentAdd"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_pmp_newapartment')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateResident"><i class="icon-folder-open-alt"></i> <?php echo lang('sidebar_pmp_resident')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estatePastResident"><i class="icon-folder-open-alt"></i> <?php echo lang('sidebar_pmp_pastresident')?></a></li>
                        <li><a href="<?php echo site_url(); ?>admin/estateResidentAdd"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_pmp_newresident')?></a></li>
                        <!--li><a href="<?php echo site_url(); ?>booking/addReservationAvailability"><i class="icon-plus-sign-alt"></i> <?php echo "Apartment availability"; ?></a></li-->
                        
                    </ul>
                </div>
            </div>
            <?php } ?>
            <?php if ($this->session->userdata('page') == 25 || $this->session->userdata('page') == 12) { ?>
            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion41" href="#collapse41"><i class="icon-folder-open-alt"></i> Staffs </a>
                </div>
                <div id="collapse41" class="accordion-body collapse <?php $status = 'in'; if(strstr(uri_string(), '/admin') == '/admin/hrmNewStaff'){ $status = 'out'; }else{ $status = 'in'; } echo $status; ?>">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/hrmStaffList"><i class="icon-plus-sign-alt"></i> Manage Staff</a></li>
                        <li><a href="<?php echo site_url(); ?>admin/hrmNewStaff"><i class="icon-plus-sign-alt"></i> Add Staff</a></li>
                    </ul>
                </div>
            </div>

            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion42" href="#collapse42" ><i class="icon-folder-open-alt"></i> Jobs</a>
                </div>
                <div id="collapse42" class="accordion-body collapse <?php if(strstr(uri_string(), '/admin') == '/admin/hrmJobList' || strstr(uri_string(), '/admin') == '/admin/hrmNewJob'){ echo "out"; }else{ echo 'in'; }  ?>">
                    <ul class="nav nav-list">
                        <li><a href="<?php echo site_url(); ?>admin/hrmJobList"><i class="icon-plus-sign-alt"></i> Manage Jobs</a></li>
                        <li><a href="<?php echo site_url(); ?>admin/hrmNewJob"><i class="icon-plus-sign-alt"></i> Add Jobs</a></li>
                    </ul>
                </div>
            </div>

            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion43" href="#collapse43" ><i class="icon-folder-open-alt"></i> <?php echo lang('sidebar_hrm_timesheet')?> </a>

                </div>
                <div id="collapse43" class="accordion-body collapse <?php $status = 'in'; if(strstr(uri_string(), '/timesheets') == '/timesheets/calendar/'.$this->session->userdata('user_id') || strstr(uri_string(), '/timesheets') == '/timesheets/add' || strstr(uri_string(), '/timesheets') == '/timesheets/all' || strstr(uri_string(), '/timesheets') == '/timesheets/approved' || strstr(uri_string(), '/timesheets') == '/timesheets/overview'){ $status = 'out'; }else{ $status = 'in';} echo $status; ?>">
                    <ul class="nav nav-list">
                        <li>
                            <a href="<?php echo site_url(); ?>timesheets/add"><i class="icon-plus-sign-alt"></i> <?php echo lang('hrm_sidemenu_timesheet_new')?></a>
                        </li>
                        <li>
                            <a href="<?php echo site_url(); ?>timesheets/all"><i class="icon-plus-sign-alt"></i> <?php echo lang('hrm_sidemenu_timesheet_tableview')?></a>
                        </li>
                        <li>
                            <a href="<?php echo site_url(); ?>timesheets/approved"><i class="icon-plus-sign-alt"></i> <?php echo lang('hrm_sidemenu_timesheet_approved')?></a>
                        </li>
                        <li>
                            <a href="<?php echo site_url(); ?>timesheets/overview"><i class="icon-plus-sign-alt"></i> <?php echo lang('hrm_sidemenu_timesheet_overview')?></a>
                        </li>
                    </ul>
                </div>
            </div>

            <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion44" href="#collapse44" ><i class="icon-folder-open-alt"></i>Leave Management </a>

                </div>
                <div id="collapse44" class="accordion-body collapse <?php if(strstr(uri_string(), '/vacations') == '/vacations/all' || strstr(uri_string(), '/vacations') == '/vacations/calendar' || strstr(uri_string(), '/vacations') == '/vacations/add'){ echo "out"; }else{ echo 'in'; }  ?>">
                    <ul class="nav nav-list">
                        <li>
                            <a href="<?php echo site_url(); ?>vacations/calendar"><i class="icon-plus-sign-alt"></i> <?php echo lang('hrm_sidemenu_vacation_calendar_view')?></a>
                        </li>
                        <li>
                            <a href="<?php echo site_url(); ?>vacations/add"><i class="icon-plus-sign-alt"></i> New Leave</a>
                        </li>
                    </ul>
                </div>
            </div>

             <div class="accordion-group">
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion45" href="#collapse45" onclick="window.location.href='<?php echo site_url(); ?>timesheets/organization'"><i class="icon-folder-open-alt"></i> <?php echo lang('hrm_sidemenu_organization')?> </a>

                </div>
            </div>

        
            <?php } ?>
            <?php if ($this->session->userdata('page') == 9 || $this->session->userdata('page') == 26 || $this->session->userdata('page') == 8 || $this->session->userdata('page') == 17) { ?>
            <div class="accordion-group">   <!--  SideBar Booking Head  is here -->
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse"
                       data-parent="#accordion17" href="#collapse17"><i class="icon-home"></i> <?php echo lang('sidebar_booking_head')?> </a>
                </div>
                <div id="collapse17" class="accordion-body collapse <?php echo (strstr(uri_string(), '/booking')) ? "in" : (uri_string() == 'admin') ? "in" : ""  ?>">
                    
                    <ul class="nav nav-list">
                    
                        <li><a href="<?php echo site_url(); ?>booking/addReservation"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_booking_reservation')?></a></li>
                        
                        
                        <li><a href="<?php echo site_url(); ?>booking/bookingavailabilitynew"><i class="icon-home"></i> <?php echo "Booking view"; ?></a></li>
                    
                        <li><a href="<?php echo site_url(); ?>booking/addReservationAvailabilityList"><i class="icon-plus-sign-alt"></i> <?php echo "Booking Availability List"; ?></a></li>
                        <li><a href="<?php echo site_url(); ?>booking/addReservationAvailability"><i class="icon-plus-sign-alt"></i> <?php echo lang('sidebar_booking_reservation_availability')?></a></li>
                    </ul>
                </div>
            </div>
            <?php } ?>
        <?php } ?>
       
    </div>
    <!--/.well -->
</div>







<?php
if($this->session->userdata('page') != 1){
?>  
<script>
$(document).ready( function () {
    $(".collapse").collapse()({
      show: false
      });
});
</script>

<?php }?>